

/*

	This is the master do-file to run all codes by block

*/

** Make sure to set up the correct working directory **
cd "../replication-package"  


* Step 1. Set up couple-linked data from CPS individual data
do "codes/setup/01_setup.do"
do "codes/setup/02a_racebridge.do"
do "codes/setup/02b_empstat.do"
do "codes/setup/03_linking.do"
do "codes/setup/04_sampledef.do"
do "codes/setup/05_final_cleanup.do"

* Step 2. Set up state-level indicators 
do "codes/state-level/01_wagegap_cps.do"
do "codes/state-level/02_lfrategap_cps.do"
do "codes/state-level/03_occpaygap_cps.do"
do "codes/state-level/04_value_gss.do"
do "codes/state-level/05_maleleg_CAWP.do"
do "codes/state-level/06_evanpro_ARDA.do"
do "codes/state-level/07_controls_ASEC.do"

use "data/state/01_wagegap_cps_19822020.dta", clear 
merge 1:1 year state_a using "data/state/02_lfrate_ratio.dta", nogen 
merge 1:1 year state_a using "data/state/03_occ60ratio_CPS.dta", nogen 
merge 1:1 year state_a using "data/state/04_motherwork_value_GSS.dta", nogen 
merge 1:1 year state_a using "data/state/05_pct_maleleg_CAWP.dta", nogen 
merge 1:1 year state_a using "data/state/06_evanpro_ARDA.dta", nogen
merge 1:1 year state_a using "data/state/07_controls_ASEC.dta", nogen 
merge 1:1 year state_a using "data/state/07_medwage_ASEC.dta", nogen 
merge 1:1 year state_a using "data/state/07_wrkhr_return_ASEC.dta", nogen 
merge 1:1 year state_a using "data/state/07_gender_poverty_gap_ASEC.dta", nogen 
sort state_a year
save "data/state/state_indicators_all.dta", replace  

// clean the state-level variables 
do "codes/runs/02_cleaning_state.do"


* Step 3. Clean and define linked couple-level data and merge with state-level indicators 
do "codes/runs/02_cleaning_couple.do"


* Step 4. Analyses 
do "codes/runs/03_main_results.do"
do "codes/runs/04_supplementary.do"

* Step 5. Figures using R 

